package com.nikkerball.apps.darkhorse.dao.hibernate;

import com.nikkerball.apps.darkhorse.dao.ModelDao;
import com.nikkerball.apps.darkhorse.model.core.Classroom;
import com.nikkerball.apps.darkhorse.model.core.Learner;
import com.nikkerball.apps.darkhorse.model.core.Subject;
import com.nikkerball.apps.darkhorse.model.evaluation.EvaluationPeriod;
import com.nikkerball.apps.darkhorse.model.evaluation.subject.SubjectEvaluation;
import org.hibernate.Criteria;
import org.hibernate.criterion.Projections;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import java.util.List;

/**
 * The Hibernate implementation of the ModelDao Interface
 *
 * @author marius (created on 2010-11-23)
 */
public class ModelDaoHibernateImpl extends HibernateDaoSupport implements ModelDao {

    // ----- ModelDao -----

    public int getClassroomCount() {
        Criteria criteria = getSession().createCriteria(Classroom.class);
        return ((Number) criteria.setProjection(Projections.rowCount()).uniqueResult()).intValue();
    }

    public List<Classroom> getClassroomList(int start, int count) {
        //noinspection unchecked
        return getHibernateTemplate().loadAll(Classroom.class);
    }

    public int getEvaluationPeriodCount(EvaluationPeriod exampleEvaluationPeriod) {
        // TODO - real implementation
        return 0;
    }

    public List<EvaluationPeriod> getEvaluationPeriodList(EvaluationPeriod exampleEvaluationPeriod, int start,
            int count) {
        // TODO - real implementation
        return null;
    }

    public int getLearnersCount(Learner exampleLearner) {
        // TODO - real implementation
        return 0;
    }

    public List<Learner> getLearnersList(Learner exampleLearner, int start, int count) {
        // TODO - real implementation
        return null;
    }

    public int getSubjectCount(Subject exampleSubject) {
        // TODO - real implementation
        return 0;
    }

    public int getSubjectEvaluationCount(SubjectEvaluation exampleSubjectEvaluation) {
        // TODO - real implementation
        return 0;
    }

    public List<SubjectEvaluation> getSubjectEvaluationList(SubjectEvaluation exampleSubjectEvaluation, int start,
            int count) {
        // TODO - real implementation
        return null;
    }

    public List<Subject> getSubjectList(Subject exampleSubject, int start, int count) {
        // TODO - real implementation
        return null;
    }


}
